You searched for: “temporibus mores sapiens sine crimine mutat
Temporibus mores sapiens sine crimine mutat. (Latin proverb)
Translation: "The wise man does no wrong in changing his habits with the times."

From Cato in his Disticha de Moribus, c. 175 B.C.